package com.easy.customer.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.easy.common.bean.CustomerContacts;
import com.easy.common.bean.CustomerInteractions;
import com.easy.common.bean.Product;
import com.easy.common.service.ICustomerInteractionsService;
import com.easy.common.util.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("customerinteractions")
public class CustomerInteractionsController {
    @Autowired
    ICustomerInteractionsService customerInteractionsService;
    @PostMapping("/")
    public ResultData insert (@RequestBody CustomerInteractions customerInteractions) {
        CustomerInteractions data=customerInteractionsService.insert(customerInteractions);
        return ResultData.success(data);
    }

    @PutMapping("/")
    public ResultData update (@RequestBody CustomerInteractions customerInteractions) {
        CustomerInteractions data=customerInteractionsService.update(customerInteractions);
        return ResultData.success(data);
    }
    @GetMapping("/{id}")
    public ResultData getByID(@PathVariable Integer id) {
        CustomerInteractions data=customerInteractionsService.getByID(id);
        return ResultData.success(data);
    }
    @GetMapping("/page")
    public ResultData getListByPage(IPage page, CustomerInteractions customerInteractions) {
        IPage<CustomerInteractions> data=customerInteractionsService.getListByPage(page,customerInteractions);
        return ResultData.success(data);
    }

}
